<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .ad{
            position: absolute;
            width: 200px;
            height: 250px;
            margin: 100px auto;
        }
        .ad p{
            position: absolute;
            top: 300px;
            right: 80px;
            font-size: 15px;
            color: black;
        }
    </style>
</head>
<body>
    <div class="ad"><img src="e3ea93a6171c9d1466520e117ed97c6.jpg" alt="" style="margin: auto;">
    <p></p></div>
</body>
<script>
    let ad = document.querySelector('.ad');
    let tip = document.querySelector('p');
    let time = 3;
    fn();
    let timerv = setInterval(fn,1000);
    function fn(){
        if (time == 0){
            ad.style.display = 'none';
            clearInterval(timer);
        }
        tip.innerHTML = time +'秒后关闭广告';
        time--;
    }
</script>
</html>